<html>
<head>
    <meta charset="UTF-8"/>
    <title>水族-后台管理系统</title>
    <meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta name="robots" content="noindex,nofollow">
    <!-- HTML5 shim for IE8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <![endif]-->
    <link rel="shortcut icon" href="/admin/img/favicon.ico">
    <link href="/admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="/admin/css/font-awesome.min93e3.css" rel="stylesheet" type="text/css">
    <link href="/admin/css/login.css" rel="stylesheet">
</head>
<body>
<div class="wrap">
    <div class="container">
        <div class="row">
            <div class="login-div">
                <h1 class="text-center">
                	<strong>水族-后台管理系统</strong>
                </h1>
                <form>
                    <div class="form-group">
                        <input type="text" id="input_username" class="form-control" name="username"
                               placeholder="账号" title="账号"
                               value="{:cookie('admin_username')}" data-rule-required="true" data-msg-required=""/>
                    </div>

                    <div class="form-group">
                        <input type="password" id="input_password" class="form-control" name="password"
                               placeholder="密码" title="密码" data-rule-required="true"
                               data-msg-required=""/>
                    </div>

                    <div class="form-group">
                        <button class="btn btn-primary btn-block" type="button" style="margin-left: 0px"
                                data-loadingmsg="登录" id="login">登录
                        </button>
                    </div>
                </form>
                <div class="form-group">
                    <h5>技术支持：广州市正解互动设计有限公司</h5>
                    <p style="font-size:5px;">公司地址：广州市海珠区新港东路世港国际（海珠创意园）B栋 701-702 、 707-708</p>
                    <p style="font-size:5px;">电话：020-28296445  18027360580</p>
                </div>
            </div>
        </div>

    </div>
</div>
</body>
<script src="/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="/admin/js/layer/layer.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $("#login").click(function(){
            var username = $("#input_username").val();
            var password = $("#input_password").val();
            if (username==="") {
                layer.alert("账号不能为空");
                return false;
            }else if(password===""){
                layer.alert("密码不能为空");
                return false;
            }else{
                var data = {'username':$("#input_username").val(),'password':$("#input_password").val()}
                $.ajax({
                    type:"post",
                    url:"{:url('admin/login/postCheck')}",
                    async: false,
                    data:data,
                    dataType:'json',
                    success:function(res){ 
                        if(res.data === 0){
                            layer.alert(res.msg);
                            setTimeout(function(){
                                window.location.href="{:url('admin/Index/index')}";
                            },2000);
                        }else if(res.data === 1){
                            layer.alert(res.msg);
                            return false;
                        }else if(res.data === 2){
                            layer.alert(res.msg);
                            return false;
                        }else if(res.data === 3){
                            layer.alert(res.msg);
                            return false;
                        }

                    },
                    error:function(res){
                        layer.alert("服务器出错!")
                    }
                });
            }
            
        });
    });
</script>
</html>
